# coding: utf-8
module ApplicationHelper

  def menuclass(keyword)
    return ' class="focus"' if(request.url.include? keyword)
    return ' class="focus"' if(@h1_name == '最新笑话' and keyword == '/new')
  end

  # 后台导航样式类名
  def navclass(keyword)
  	return ' class="active"' if(request.url.include? keyword)
  end

  # 标题
  def gettitle
  	return @page_title if(@page_title != nil)
  	'逗死了'
  end

  # 关键词
  def getkeywords
  	return getkeywordsByPara(@page_keywords) if(@page_keywords != nil)
  end

  # 描述
  def getdesc
  	return getdescByPara @page_desc if(@page_desc != nil)
  end

private

  def getkeywordsByPara(keywords)
    '<meta name="keywords" content="' << keywords << '" />'
  end

  def getdescByPara(desc)
    '<meta name="description" content="' << desc <<'" />'
  end

end
